import { Image, ImageProps } from "@tarojs/components";
import style from "./index.module.scss";

export const IconsLookup = {
  LEcoleLogo: "lecole-logo-s.png",
  BackNav: "back-nav.png",
  Home: "home.png",
  HomeBorder: "home-border.png",
  DownChevron: "down-chevron.png",
  DownChevronBlack: "down-chevron-black.png",
  Favorite: "favorite.png",
  FavoriteFilled: "favorite-filled.png",
  HelpDesk: "help-desk.png",
  HelpDeskFloating: "help-desk-floating.png",
  Location: "location.png",
  LocationGold: "location-gold.png",
  LocationDark: "location-dark.png",
  Filter: "filter.png",
  HomeLoadingLogo: "home-loading-logo.png",
  LoadingIndicator: "loading-indicator.png",
  Edit: "edit.png",
  QR: "qr-code.png",
  Cart: "cart.png",
  CartFloating: "cart-floating.png",
  GiftCard: "giftcard.png",
  Arrow: "arrow.png",
  ArrowBlue: "arrow-blue.png",
  ArrowBlack: "arrow-black.png",
  CloseWhite: "close-white.png",
  CloseBlack: "close-black.png",
  Delete: "delete.png",
  Plus: "plus.png",
  Minus: "minus.png",
  WeChat: "wechat.png",
  GoToChevron: "go-to-chevron.png",
  GoToChevronViking: "go-to-chevron-viking.png",
  StarEmpty: "star-empty.png",
  StarFull: "star-full.png",
  EllipseDark: "ellipse-dark.png",
  EllipseGrey: "ellipse-grey.png",
  SF: "sf-express.png",
};

type Icons = keyof typeof IconsLookup;

interface IconProps extends Omit<ImageProps, "src"> {
  type: Icons;
}

const Icon = ({ type, ...props }: IconProps) => {
  return (
    <Image
      className={style["icon"]}
      src={`/assets/icons/${IconsLookup[type]}`}
      {...props}
    />
  );
};

export default Icon;
